<!DOCTYPE html>
<html>
<head>
    <title>忘记密码</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" href="${s.base}/mobile/base/css/weui.min.css">
    <link rel="stylesheet" href="${s.base}/mobile/base/css/jquery-weui.css">
    <link rel="stylesheet" href="${s.base}/mobile/base/css/base.css?123456">
    <link rel="stylesheet" href="${s.base}/mobile/base/css/component.css?123456">
    <style type="text/css">
        html, body {
            background: #ffffff;
        }

        .xyg-comp-yzm {
            width: 180px;
            height: 50px;
            line-height: 50px;
            text-align: center;
            font-size: 28px;
            float: right;
            border-radius: 25px;
            color: #E92333;
            border: 1px solid #E92333;
        }

        .xyg-login {
            width: 610px;
            margin: 0px 70px;
            height: auto;
            padding-top: 30px;
        }

        .xyg-login-item {
            width: 100%;
            margin: 10px 0px;
            height: auto;
            padding: 25px 0px;
            border-bottom: 1px solid #D7D7D7;
        }

        .xyg-login-item .xyg-login-icon {
            width: 50px;
            float: left;
        }

        .xyg-login-item .xyg-login-icon img {
            width: auto;
            height: 36px;
            margin: 0px auto;
        }

        .xyg-login-item .xyg-login-input {
            width: 540px;
            margin-left: 20px;
            height: 50px;
            float: left;
        }

        .xyg-login-item .xyg-login-input input {
            width: 100%;
            height: 50px;
            color: #999999;
        }

        .xyg-comp-btn1 {
            width: 100%;
            height: 88px;
            line-height: 88px;
            color: #ffffff;
            font-size: 32px;
            letter-spacing: 5px;
            background: #FF4B5A;
            text-align: center;
            border-radius: 44px;
            margin-top: 60px;
        }

        .xyg-login-text {
            padding-top: 30px;
        }

        .xyg-login-tip {
            position: absolute;
            bottom: 30px;
            width: 100%;
            text-align: center;
        }
    </style>
</head>
<body>
<div class="xyg-login">
    <div class="xyg-login-item">
        <div class="xyg-login-icon">
            <img src="${s.base}/mobile/base/images/icon_phone.png"/>
        </div>
        <div class="xyg-login-input" style="width:300px;">
            <input type="text" id="phone" class="xyg-comp-input-noborder font-base1-size" placeholder="请输入手机号码"/>
        </div>
        <div class="xyg-comp-yzm" onclick="sendSms()" id="sendSms">
            获取验证码
        </div>
        <div class="clearBoth"></div>
    </div>
    <div class="xyg-login-item">
        <div class="xyg-login-icon">
            <img src="${s.base}/mobile/base/images/icon_psw.png"/>
        </div>
        <div class="xyg-login-input">
            <input type="password" id="code" class="xyg-comp-input-noborder font-base1-size" placeholder="请输入验证码"/>
        </div>
        <div class="clearBoth"></div>
    </div>
    <div class="xyg-login-item">
        <div class="xyg-login-icon">
            <img src="${s.base}/mobile/base/images/icon_psw.png"/>
        </div>
        <div class="xyg-login-input">
            <input type="password" id="password" class="xyg-comp-input-noborder font-base1-size" placeholder="请输入密码"/>
        </div>
        <div class="clearBoth"></div>
    </div>
    <div class="xyg-login-item">
        <div class="xyg-login-icon">
            <img src="${s.base}/mobile/base/images/icon_psw.png"/>
        </div>
        <div class="xyg-login-input">
            <input type="password" id="checkPassword" class="xyg-comp-input-noborder font-base1-size"
                   placeholder="请再次输入密码"/>
        </div>
        <div class="clearBoth"></div>
    </div>
    <div class="xyg-comp-btn1" onclick="submit();">
        提交
    </div>

</div>


</body>
<script src="${s.base}/mobile/base/js/jquery-2.1.4.js"></script>
<script type="text/javascript">
    var dpi = 750;
    var phoneWidth = parseInt(window.screen.width);
    var phoneScale = phoneWidth / 750;
    var ua = navigator.userAgent;
    if (/Android (\d+\.\d+)/.test(ua)) {
        var version = parseFloat(RegExp.$1);
        if (version > 2.3) {
            document.write('<meta name="viewport" content="width=' + dpi + ', minimum-scale = ' + phoneScale + ', maximum-scale = ' + phoneScale + ', target-densitydpi=device-dpi">');
        } else {
            document.write('<meta name="viewport" content="width=' + dpi + ', target-densitydpi=device-dpi">');
        }
    } else {
        document.write('<meta name="viewport" content="width=' + dpi + ', user-scalable=no, target-densitydpi=device-dpi">');
    }
</script>
<script src="${s.base}/mobile/base/js/jquery-weui.js"></script>
<script src="${s.base}/mobile/base/js/swiper.js"></script>
<script src="${s.base}/mobile/base/fonts/iconfont.js"></script>
<script src="${s.base}/mobile/base/js/component.js"></script>
<script src="${s.base}/mobile/base/js/base.js?123456789000"></script>
<script type="text/javascript">
    var dpi = 750;
    var phoneWidth = parseInt(window.screen.width);
    var phoneScale = phoneWidth / 750;
    var ua = navigator.userAgent;
    if (/Android (\d+\.\d+)/.test(ua)) {
        var version = parseFloat(RegExp.$1);
        if (version > 2.3) {
            document.write('<meta name="viewport" content="width=' + dpi + ', minimum-scale = ' + phoneScale + ', maximum-scale = ' + phoneScale + ', target-densitydpi=device-dpi">');
        } else {
            document.write('<meta name="viewport" content="width=' + dpi + ', target-densitydpi=device-dpi">');
        }
    } else {
        document.write('<meta name="viewport" content="width=' + dpi + ', user-scalable=no, target-densitydpi=device-dpi">');
    }

    $(document).ready(function (e) {
        initDate();
    });

    function initDate() {
        $.fn.initXygCompBanner("", ".xyg-comp-banner-swiper1", 417);
    }
    var memberId = '${memberId}';
    function submit() {
        var phone = $("#phone").val();
        if (phone == null || phone == "") {
            $.toast("请输入手机号", "text");
            return false;
        } else if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(phone))) {
            $.toast("手机码填写错误", "text");
            return false;
        }
        var code = $("#code").val();
        if (code == null || code == "") {
            $.toast("请输入验证码", "text");
            return false;
        }
        var password = $("#password").val();
        if (password == null || password == "") {
            $.toast("请输入密码", "text");
            return false;
        }
        var checkPassword = $("#checkPassword").val();
        if (checkPassword == null || checkPassword == "") {
            $.toast("请输入再次输入密码", "text");
            return false;
        }
        if (checkPassword != password) {
            $.toast("两次输入密码不一致，请确认", "text");
            return false;
        }
        $.fn.postMethodResult("/weChat/webMember/repPassword", {'memberId': memberId,'phone': phone,'password': password,'code': code }, function (data) {
            $.alert("操作成功", function () {
                goFistPage(memberId);
            });
        });
    }

    var sendFlage = true;//发送标志，true为可以发送
    function sendSms() {
        if (!sendFlage) {
            return false;
        }
        sendFlage = false;
        var phone = $("#phone").val();
        if (phone == null || phone == "") {
            $.toast("请输入手机号", "text");
            sendFlage = true;
            return false;
        } else if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(phone))) {
            $.toast("手机码填写错误", "text");
            sendFlage = true;
            return false;
        }

        $.fn.postBase("/weChat/smsSend", {'phone': phone}, function (result) {
            if (result.code === 0) {
                //操作成功
                $.toast("短信发送成功", "text");
                getRandomCode();
            } else {
                sendFlage = false;
                //操作失败
                $.toast(result.msg, "text");
            }
        });
    }

    var time = 60;

    //倒计时
    function getRandomCode() {
        if (time === 0) {
            time = 60;
            sendFlage = true;
            $('#sendSms').html("获取验证码");
            return;
        } else {
            time--;
            $('#sendSms').html(time + "秒");
        }
        setTimeout(function () {
            getRandomCode();
        }, 1000);
    }
</script>

</html>

